;---------------------------------------------------------------------------
;Wave Beam
[Statedef 3000]
type    = S
movetype= A
physics = S
velset = 0,0
anim = 3000
ctrl = 0
sprpriority = 2
facep2 = 1

[State 3000, 1]
type = SuperPause
trigger1 = !Time
anim = -1
time = 32
sound = F8020, 0
darken = 0
poweradd = -1000
movetime = 6

[State 3000, 2]
type = Helper
trigger1 = !Time
name = "Super Helper"
ID = 6002
stateno = 6002
pos = ceil(-1*const(size.xscale)),ceil(-37*const(size.yscale))
postype = p1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 3000, 3]
type = Explod
trigger1 = !Time
anim = F6003
ID = 6002
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 32
supermovetime = 999
pausemovetime = 999
scale = 1,1
sprpriority = -990
ownpal = 1
removeongethit = 1

[State 3000, 4]
type = Explod
triggerall = !NumPartner && !NumExplod(8030)
trigger1 = Time = 7 && TeamSide = 1
anim = 8038
ID = 8030
pos = 87,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 65
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 3000, 5]
type = Explod
triggerall = !NumPartner && !NumExplod(8030)
trigger1 = Time = 7 && TeamSide = 2
anim = 8038
ID = 8030
pos = 231,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 65
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 3000, 6]
type = Helper
trigger1 = Time = 12 || Time = 15 || Time = 18  
name = "Wave Beam Shot" 
ID = 3000
stateno = 3001
pos = ceil(32*const(size.xscale)),ceil(-54*const(size.yscale))
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 3000, 7]
type = StateTypeSet
trigger1 = Time = 11
movetype = A

[State 3000, 8]
type = StateTypeSet
trigger1 = Time = 19
movetype = I

[State 3000, 9]
type = PlaySnd
trigger1 = Time = 12 || Time = 15 || Time = 18 
value = S1010,0

[State 3000, 10]
type = VarAdd
trigger1 = Time = 12 || Time = 15 || Time = 18  
var(37) = 1

[State 3000, 11]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1
;---------------------------------------------------------------------------
;Wave Beam Shot
[Statedef 3001]
type    = A
movetype= A
physics = N
velset = 5*const(size.xscale),0
anim = 3001
ctrl = 0
sprpriority = 2

[State 3001, 1]
type = HitOverride
trigger1 = 1
attr = SCA,HP
slot = 0
stateno = 3002
time = 1
ignorehitpause = 1

[State 3001, 2]
type = HitBy
trigger1 = 1
value = SCA,HP
time = 1

[State 3001, 3]
type = VelSet
trigger1 = 1
x = 5*const(size.xscale)
y = (11*sin(time/3))*const(size.yscale)

[State 3001, 4]
type = HitDef
trigger1 = !Time
attr = A, HP
damage = ceil(90*root,Fvar(20)),23
animtype = Hard
guardflag = MA
hitflag = MAF
priority = 4, Hit
getpower = 0
givepower = 67, 34
pausetime = 1,8
sparkno = S6001
sparkxy = -9,0
hitsound = F5, 3
guardsound = F6, 0
ground.type = High
ground.slidetime = 17
guard.slidetime = 17
ground.hittime = 19
guard.hittime = 19
ground.velocity = -5*const(size.xscale), -3.2*const(size.yscale)
air.type = High
air.velocity = -4.2*const(size.xscale),-2.8*const(size.yscale)
air.hittime = 100
yaccel = .35*const(size.yscale)
fall = 1
fall.recover = 0
fall.recovertime = 1
id = 3000
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 3001, 8]
type = Null
trigger1 = NumTarget && MoveHit && HitCount = 1 && root,Fvar(21) > .3 && root,var(20) = 0
fvar(21) = -0.2
ignorehitpause = 1
persistent = 0

[State 3001, 5]
type = ParentVarAdd
triggerall = NumTarget && MoveHit
trigger1 = HitPauseTime = 1
var(5) = 10
ignorehitpause = 1

[State 3001, 6]
type = ParentVarAdd
trigger1 = NumTarget && MoveHit && root,Var(20) = 0
var(20) = 3
ignorehitpause = 1
persistent = 0

[State 3001, 7]
type = ParentVarSet
triggerall = NumTarget && RoundState = 3
trigger1 = WinKO
var(28) = 300
ignorehitpause = 1

[State 3001, 8]
type = ChangeState
trigger1 = MoveContact || FrontEdgeDist < -40
value = 3002
;---------------------------------------------------------------------------
;Wave Beam Shot (Hit/Disappear)
[Statedef 3002]
type    = A
movetype= H
physics = N
velset = 0,0
anim = 1
ctrl = 0
sprpriority = 2

[State 3002, 1]
type = ParentVarAdd
trigger1 = !Time
var(37) = -1

[State 3002, 2]
type = DestroySelf
triggerall = Time
trigger1 = !NumTarget
trigger2 = NumTarget
trigger2 = target,StateType = L
;---------------------------------------------------------------------------
;Wave Beam (Air)
[Statedef 3005]
type    = A
movetype= I
physics = N
velset = 0,0
anim = 3005
ctrl = 0
sprpriority = 2

[State 3005, 1]
type = SuperPause
trigger1 = !Time
anim = -1
time = 32
sound = F8020, 0
darken = 0
poweradd = -1000
movetime = 6

[State 3005, 2]
type = Helper
trigger1 = !Time
name = "Super Helper"
ID = 6002
stateno = 6002
pos = ceil(-1*const(size.xscale)),ceil(-37*const(size.yscale))
postype = p1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 3005, 3]
type = Explod
trigger1 = !Time
anim = F6003
ID = 6002
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 32
supermovetime = 999
pausemovetime = 999
scale = 1,1
sprpriority = -990
ownpal = 1
removeongethit = 1

[State 3005, 4]
type = Explod
triggerall = !NumPartner && !NumExplod(8030)
trigger1 = Time = 7 && TeamSide = 1
anim = 8038
ID = 8030
pos = 87,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 65
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 3005, 5]
type = Explod
triggerall = !NumPartner && !NumExplod(8030)
trigger1 = Time = 7 && TeamSide = 2
anim = 8038
ID = 8030
pos = 231,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 65
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 3005, 6]
type = Helper
trigger1 = Time = 12 || Time = 15 || Time = 18  
name = "Wave Beam Shot" 
ID = 3000
stateno = 3001
pos = ceil(32*const(size.xscale)),ceil(-54*const(size.yscale))
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 3005, 7]
type = StateTypeSet
trigger1 = Time = 11
movetype = A

[State 3005, 8]
type = StateTypeSet
trigger1 = Time = 19
movetype = I

[State 3005, 9]
type = VelSet
trigger1 = AnimElem = 5
x = -1.8*const(size.xscale)
y = -2*const(size.yscale)

[State 3005, 10]
type = VelAdd
trigger1 = AnimElemTime(5) >= 0 
y = .44*const(size.yscale)

[State 3000, 11]
type = PlaySnd
trigger1 = Time = 12 || Time = 15 || Time = 18 
value = S1010,0

[State 3005, 11]
type = VelAdd
trigger1 = AnimElemTime(6) >= 0 
y = .44*const(size.yscale)

[State 3005, 12]
type = VarAdd
trigger1 = Time = 12 || Time = 15 || Time = 18  
var(37) = 1

[State 3005, 13]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y && AnimElemTime(6) >= 0 
value = 3006
;---------------------------------------------------------------------------
;Wave Beam (Land)
[Statedef 3006]
type    = S
movetype= I
physics = N
anim = 3006
velset = 0,0
ctrl = 0
sprpriority = 2

[State 3006, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 3006, 2]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1
;---------------------------------------------------------------------------
;Mine Lay
[Statedef 3050]
type    = S
movetype= A
physics = S
velset = 0,0
anim = 3050
ctrl = 0
sprpriority = 2
facep2 = 1

[State 3050, 1]
type = SuperPause
trigger1 = !Time
anim = -1
time = 32
sound = F8020, 0
darken = 0
poweradd = -1000
movetime = 9

[State 3050, 2]
type = Helper
trigger1 = !Time
name = "Super Helper"
ID = 6002
stateno = 6002
pos = ceil(-1*const(size.xscale)),ceil(-27*const(size.yscale))
postype = p1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 3050, 3]
type = Explod
trigger1 = !Time
anim = F6003
ID = 6002
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 32
supermovetime = 999
pausemovetime = 999
scale = 1,1
sprpriority = -990
ownpal = 1
removeongethit = 1

[State 3050, 4]
type = Explod
triggerall = !NumPartner && !NumExplod(8030)
trigger1 = Time = 10 && TeamSide = 1
anim = 8039
ID = 8030
pos = 87,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 65
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 3050, 5]
type = Explod
triggerall = !NumPartner && !NumExplod(8030)
trigger1 = Time = 10 && TeamSide = 2
anim = 8039
ID = 8030
pos = 231,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 65
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 3050, 6]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 3050, 7]
type = AssertSpecial
trigger1 = (GameTime % 2) = 0
flag = invisible

[State 3050, 8]
type = PlaySnd
trigger1 = AnimElem = 4 
value = S5120,0

[State 3050, 9]
type = ChangeState
trigger1 = !AnimTime
value = 3051
;---------------------------------------------------------------------------
;Mine Lay
[Statedef 3051]
type    = S
movetype= A
physics = N
velset = -3.4*const(size.xscale),0
anim = 3051
ctrl = 0
sprpriority = 2

[State 3051, 1]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1

[State 3051, 2]
type = Helper
trigger1 = AnimElem = 1 || !AnimTime
name = "Mine"
ID = 3050
stateno = 3055
pos = 0,0
postype = p1    
facing = 1
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 3051, 3]
type = AssertSpecial
trigger1 = (GameTime % 2) = 0
flag = invisible

[State 3051, 4]
type = VarAdd
trigger1 = AnimElem = 1 || !AnimTime
var(37) = 1

[State 3051, 5]
type = PlaySnd
trigger1 = AnimElem = 1 || !AnimTime
value = S1160,0

[State 3051, 6]
type = ChangeState
trigger1 = Time = 45
value = 3052
;---------------------------------------------------------------------------
;Mine Lay
[Statedef 3052]
type    = S
movetype= I
physics = N
velset = 0,0
anim = 3052
ctrl = 0
sprpriority = 2

[State 3051, 1]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1
;---------------------------------------------------------------------------
;Mine
[Statedef 3055]
type    = S
movetype= A
physics = N
velset = 0,0
anim = 3055
ctrl = 0
sprpriority = 5

[State 3055, 1]
type = HitDef
trigger1 = !Time
attr = A, HA
damage = ceil(80*root,Fvar(20)),20
animtype = Hard
guardflag = MA
hitflag = MAF
priority = 4, Hit
getpower = 0
givepower = 50, 25
pausetime = 1,3
sparkno = S6001
sparkxy = -9,0
hitsound = F5, 4
guardsound = F6, 0
ground.type = High
ground.slidetime = 11
guard.hittime  = 5
ground.hittime  = 18
ground.velocity = 5*const(size.xscale), -2.8*const(size.yscale)
guard.velocity = 11.7*const(size.xscale)
air.type = High
air.velocity = 4.7*const(size.xscale),-2.3*const(size.yscale)
air.hittime = 100
yaccel = .35*const(size.yscale)
fall = 1
fall.recover = 0
fall.recovertime = 1
id = 3050
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 3055, 2]
type = ParentVarSet
trigger1 = NumTarget && MoveHit && root,Var(20) = 0
var(20) = 3
ignorehitpause = 1
persistent = 0

[State 3055, 3]
type = ParentVarSet
triggerall = NumTarget && MoveHit
trigger1 = HitPauseTime = 1
var(5) = 10
ignorehitpause = 1

[State 3055, 5]
type = PlaySnd
trigger1 = AnimElem = 7
value = S1160,1

[State 3055, 6]
type = ParentVarSet
triggerall = NumTarget && RoundState = 3
trigger1 = WinKO
var(28) = 305
ignorehitpause = 1

[State 3055, 7]
type = ParentVarAdd
trigger1 = Anim != 1 && !AnimTime
var(37) = -1

[State 3055, 8]
type = ChangeAnim
trigger1 = !AnimTime
value = 1

[State 3055, 9]
type = DestroySelf
trigger1 = !NumTarget && (Anim != 1 && !AnimTime || Anim = 1)
;---------------------------------------------------------------------------
;Screw Rush
[Statedef 3100]
type    = S
movetype= A
physics = S
velset = 0,0
anim = 3100
ctrl = 0
sprpriority = 2
facep2 = 1

[State 3100, 1]
type = SuperPause
trigger1 = !Time
anim = -1
time = 32
sound = F8020, 0
darken = 0
poweradd = -1000
movetime = 13

[State 3100, 2]
type = Helper
trigger1 = !Time
name = "Super Helper"
ID = 6002
stateno = 6002
pos = ceil(-1*const(size.xscale)),ceil(-27*const(size.yscale))
postype = p1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 3100, 3]
type = Explod
trigger1 = !Time
anim = F6003
ID = 6002
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 32
supermovetime = 999
pausemovetime = 999
scale = 1,1
sprpriority = -990
ownpal = 1
removeongethit = 1

[State 3100, 4]
type = Explod
triggerall = !NumPartner && !NumExplod(8030)
trigger1 = Time = 16 && TeamSide = 1
anim = 8040
ID = 8030
pos = 87,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 65
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 3100, 5]
type = Explod
triggerall = !NumPartner && !NumExplod(8030)
trigger1 = Time = 16 && TeamSide = 2
anim = 8040
ID = 8030
pos = 231,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 65
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 3100, 6]
type = NotHitBy
trigger1 = Time < 13
value = SCA
time = 1

[State 3100, 7]
type = NotHitBy
trigger1 = Time > 13
value = ,AP
time = 1

[State 3100, 8]
type = NotHitBy
trigger1 = Time > 13
value = SC,AT
time = 1

[State 3100 9]
type = AssertSpecial
trigger1 = Time > 13 && (GameTime % 2) = 0
flag = invisible

[State 3100, 10]
type = PlaySnd
trigger1 = !Time
value = S5120,0

[State 3100, 1]
type = ChangeState
trigger1 = !AnimTime
value = 3101
;---------------------------------------------------------------------------
;Screw Rush
[Statedef 3101]
type    = A
movetype= A
physics = N
velset = 4.8*const(size.xscale),-6.9*const(size.yscale)
anim = 3101
ctrl = 0
sprpriority = 2

[State 3101, 1]
type = VelAdd
trigger1 = 1
y = .75*const(size.yscale)

[State 3101, 2]
type = HitDef
;triggerall = (!HitCount && var(5) < 10) || HitCount
trigger1 = ((AnimElem = 1 || AnimElem = 2 || AnimElem = 3 || AnimElem = 4) || !AnimTime)
attr = S, HA
damage = ceil(24*Fvar(20)),6
animtype = Hard
getpower = 0
givepower = 12,6
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 8,8
sparkno = S6001
sparkxy = -9, ceil(-31*const(size.yscale))
hitsound = F5, 2
guardsound = F6, 0
ground.type = High
ground.slidetime = 19
ground.hittime = 21
guard.hittime = 21
ground.velocity = -3.1*const(size.xscale)
ground.cornerpush.veloff = 0
air.type = High
air.velocity = -2.3*const(size.xscale), -2.1*const(size.yscale)
air.hittime = 100
yaccel = .35*const(size.yscale)
fall = 0
fall.recovertime = 1
id = 3100
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 3101, 2]
type = VarAdd
trigger1 = NumTarget && MoveHit && HitCount = 1 && Fvar(21) > .3
fvar(21) = -0.2
ignorehitpause = 1
persistent = 0

[State 3101, 3]
type = VarSet
triggerall = NumTarget && MoveHit
trigger1 = HitPauseTime = 1
var(5) = 10
ignorehitpause = 1

[State 3101, 4]
type = PlaySnd
trigger1 = !Time 
value = S190,0

[State 3050, 6]
type = NotHitBy
trigger1 = Vel Y <= 0
value = ,AP
time = 1

[State 3050, 7]
type = AssertSpecial
trigger1 = Vel Y <= 0 && (GameTime % 2) = 0
flag = invisible

[State 3101, 5]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 3102
;---------------------------------------------------------------------------
;Screw Attack
[Statedef 3102]
type    = S
movetype= A
physics = N
velset = 0, 0
anim = 3102
ctrl = 0
sprpriority = 2
hitcountpersist = 1

[State 3102, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 3102, 2]
type = ChangeState
trigger1 = !AnimTime
value = 3103
;---------------------------------------------------------------------------
;Screw Attack
[Statedef 3103]
type    = A
movetype= A
physics = N
velset = 2.6*const(size.xscale), -6.8*const(size.yscale)
anim = 3103
ctrl = 0
sprpriority = 2
hitcountpersist = 1

[State 3103, 1]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 3103, 2]
type = ChangeState
trigger1 = !AnimTime
value = 3104
;---------------------------------------------------------------------------
;Screw Attack
[Statedef 3104]
type    = A
movetype= A
physics = N
velset = 6.2*const(size.xscale),0
anim = 3101
ctrl = 0
sprpriority = 2
hitcountpersist = 1

[State 3104, 1]
type = HitDef
;triggerall = (!HitCount && var(5) < 10) || HitCount
trigger1 = ((AnimElem = 1 || AnimElem = 2 || AnimElem = 3 || AnimElem = 4) || !AnimTime)
attr = S, HA
damage = ceil(28*Fvar(20)),7
animtype = Hard
getpower = 0
givepower = 12,6
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 8,8
sparkno = S6001
sparkxy = -9, ceil(-31*const(size.yscale))
hitsound = F5, 2
guardsound = F6, 0
ground.type = High
ground.slidetime = 18
ground.hittime  = 18
ground.velocity = -3.1*const(size.xscale)
ground.cornerpush.veloff = 0
air.type = High
air.velocity = -2.3*const(size.xscale),-.8*const(size.yscale)
air.hittime = 100
yaccel = .35*const(size.yscale)
fall = 1
fall.recover = 0
fall.recovertime = 1
id = 1100
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 3104, 2]
type = VarSet
triggerall = NumTarget && MoveHit
trigger1 = HitPauseTime = 1
var(5) = 10
ignorehitpause = 1

[State 3104, 3]
type = VarAdd
trigger1 = NumTarget && MoveHit && HitCount = 1 && Fvar(21) > .3
fvar(21) = -0.2
ignorehitpause = 1
persistent = 0

[State 3104, 4]
type = PlaySnd
trigger1 = !Time 
value = S190,0

[State 3104, 4]
type = VelMul
trigger1 = Time > 4
x = .98

[State 3104, 5]
type = ChangeState
trigger1 = Time >= 17
value = 3105
;---------------------------------------------------------------------------
;Screw Attack
[Statedef 3105]
type    = A
movetype= I
physics = N
anim = 3105
ctrl = 0
sprpriority = 2
hitcountpersist = 1

[State 3103, 1]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 3103, 2]
type = VelMul
trigger1 = 1
x = .98

[State 3105, 5]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y > -Vel Y
value = 3006
;---------------------------------------------------------------------------
;Metroid Trap
[Statedef 4000]
type    = S
movetype= A
physics = S
velset = 0,0
anim = 4000
ctrl = 0
sprpriority = 2
facep2 = 1

[State 4000, 1]
type = SuperPause
trigger1 = !Time
anim = -1
time = 40
sound = F8020, 1
darken = 0
poweradd = -3000

[State 4000, 2]
type = Helper
trigger1 = !Time
name = "Super Helper"
ID = 6002
stateno = 6002
pos = ceil(-1*const(size.xscale)),ceil(-27*const(size.yscale))
postype = p1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 4000, 3]
type = Explod
trigger1 = !Time
anim = F6003
ID = 6002
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 40
supermovetime = 999
pausemovetime = 999
scale = 1,1
sprpriority = -990
ownpal = 1
removeongethit = 1

[State 4000, 4]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 4000, 5]
type = AssertSpecial
trigger1 = Time && !(GameTime % 2)
flag = invisible

[State 4000, 6]
type = Explod
trigger1 = !NumPartner && Time = 1 && TeamSide = 1
anim = 8041
ID = 8030
pos = 87,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 4000, 7]
type = Explod
trigger1 = !NumPartner && Time = 1 && TeamSide = 2
anim = 8041
ID = 8030
pos = 231,23
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = -996
ownpal = 1
removeongethit = 1

[State 4000, 8]
type = VelSet
trigger1 = Time = 1
x = 4*const(size.xscale)

[State 4000, 9]
type = ChangeState
trigger1 = !AnimTime
value = 4001

;---------------------------------------------------------------------------
;Metroid Trap
[Statedef 4001]
type    = A
movetype= A
physics = N
velset = 6.4*const(size.xscale),-9.5*const(size.yscale)
anim = 4001
ctrl = 0
sprpriority = 2

[State 4001, 1]
type = HitDef
trigger1 =  Var(5) < 10 && !Time
attr = A,HA
hitflag = MAF
guardflag = HA
animtype = Hard
priority = 4,Hit
damage = ceil(65*Fvar(20)),17
pausetime = 12,12
sparkno = S6001
guard.sparkno = -1
sparkxy = -9, ceil(-35*const(size.yscale))
hitsound = F5,3
guardsound = F6,0
ground.type = High
ground.slidetime = 12
guard.slidetime = 10
ground.hittime = 14
guard.hittime = 12
ground.velocity = -1.1*const(size.xscale), -6.2*const(size.yscale)
guard.velocity = -8.6*const(size.xscale)
air.type = High
air.hittime = 100
air.velocity = -.7*const(size.xscale), -5.9*const(size.yscale)
yaccel = .35*const(size.yscale)
fall = 1
fall.recover = 0
id = 630
chainID = -1
nochainID = -1
hitonce = 0
kill = 1
guard.kill = 1
numhits = 1
getpower = 40,30
givepower = 30,15

[State 4001, 2]
type = VarAdd
trigger1 = NumTarget && MoveHit && HitCount = 1 && Fvar(21) > .3
fvar(21) = -0.2
ignorehitpause = 1
persistent = 0

[State 4001, 3]
type = VelAdd
trigger1 = AnimElemTime(2) >= 0
y = .44*const(size.yscale)

[State 4001, 4]
type = PlaySnd
trigger1 = AnimElem = 1
value = F0, 4

[State 4001, 5]
type = VelSet
trigger1 = AnimElem = 2
x = 0
y = 0

[State 4001, 6]
type = StateTypeSet
trigger1 = AnimElem = 2
movetype = I

[State 4001, 7]
type = TargetState
triggerall = NumTarget && MoveHit
trigger1 = HitPauseTime
value = 4005
ignorehitpause = 1

[State 4001, 8]
type = Helper
trigger1 = Cond(NumTarget,(target,StateNo = 4005 && AnimElem = 3),0)
name = "Metroid"
ID = 4000
stateno = 4010
pos = 0,ceil(-50*const(size.yscale))
postype = p2
facing = -1
keyctrl = 0
ownpal = 1
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 4001, 9]
type = NotHitBy
trigger1 = !Time
value = SCA
time = 8

[State 4001, 10]
type = AssertSpecial
trigger1 = Time < 8 && !(GameTime % 2)
flag = invisible

[State 4001, 11]
type = RemoveExplod
trigger1 = !NumHelper(4000) && AnimElem = 4
id = 8030

[State 4001, 12]
type = ChangeState
trigger1 = NumHelper(4000) && Vel Y > 0 && Pos Y >= 0
value = 4002

[State 4001, 13]
type = ChangeState
trigger1 = !NumHelper(4000) &&  Vel Y > 0 && Pos Y >= 0  
value = 3006
;---------------------------------------------------------------------------
;Metroid Trap
[Statedef 4002]
type    = S
movetype= A
physics = N
anim = 4002
velset = 0,0
ctrl = 0
sprpriority = 2

[State 4002, 1]
type = PosSet
trigger1 = !Time
y = 0

[State 4002, 2]
type = Turn
trigger1 = Cond(NumTarget,Facing = 1 && ((Pos X > target,Pos X) && Facing = 1) || (Pos X < target,Pos X) && Facing = -1,0) && !Time

[State 4002, 3]
type = ChangeState
trigger1 = Time = 65
value = 4003
;---------------------------------------------------------------------------
;Metroid Trap
[Statedef 4003]
type    = S
movetype= A
physics = N
anim = 4003
ctrl = 0
sprpriority = 2

[State 4003, 3]
type = VelSet 
trigger1 = Vel X < 3 && AnimElem = 1
x = 3.4*const(size.xscale)

[State 4003, 3]
type = VelSet
trigger1 = Time = 40
x = -3.4*const(size.xscale)

[State 4003, 3]
type = SprPriority
trigger1 = Time = 40
value = -3

[State 4003, 4]
type = Helper 
trigger1 = (abs((Pos X) - helper(4000),Pos X) <= 30) && NumHelper(4010) < 5 && (Time % 2) = 0
name = "Mine"
ID = 4010
stateno = 4020
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
size.xscale = const(size.xscale)
size.yscale = const(size.yscale)

[State 4003, 5]
type = ChangeState
trigger1 = Time = 80
value = 4004
;---------------------------------------------------------------------------
;Metroid Trap
[Statedef 4004]
type    = S
movetype= A
physics = N
velset = 0,0
anim = 4004
ctrl = 0
sprpriority = 2

[State 4004, 1]
type = PlaySnd
trigger1 = AnimElem = 7 || AnimElem = 9
value = S195,0

[State 4004, 2]
type = VarSet
trigger1 = !Time
var(5) = 10

[State 4004, 3]
type = RemoveExplod
trigger1 = !NumHelper(4000) && AnimElem = 4
id = 8030

[State 4004, 4]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1
;---------------------------------------------------------------------------
;Knee'd
[Statedef 4005]
type    = A
movetype= H
physics = N
velset = -2.5,-15
ctrl = 0
sprpriority = -2

[State 4005, 1]
type = ChangeAnim
trigger1 = !Time
value = 5030

[State 4005, 2]
type = SelfState
trigger1 = Time = 25
value = 5050
;---------------------------------------------------------------------------
;Held By Metroid
[Statedef 4006]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = -2

[State 4006, 1]
type = ChangeAnim2
trigger1 = !Time
value = 4006

;---------------------------------------------------------------------------
;Held By Metroid
[Statedef 4007]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = -2

[State 4007, 1]
type = ChangeAnim2
trigger1 = !Time
value = 4007

[State 4007, 2]
type = VelAdd
trigger1 = Pos Y < 0
y = .44*const(size.yscale)

[State 4007, 3]
type = PosSet
trigger1 = Vel Y >= 0 && Pos Y >= 0
y = 0
;---------------------------------------------------------------------------
;Held By Metroid
[Statedef 4008]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = -2

[State 4008, 1]
type = ChangeAnim2
trigger1 = !Time
value = 4008 


;---------------------------------------------------------------------------
;Held By Metroid
[Statedef 4009]
type    = A
movetype= H
physics = N
velset = -.4,-19.1
ctrl = 0
sprpriority = -2

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !Time
value = 5030

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = Anim = 5030 && !AnimTime && SelfAnimExist(5035)
value = 5035

[State 0, VelAdd]
type = VelAdd
trigger1 = 1
y = .35

[State 4008, 1]
type = SelfState
trigger1 = SelfAnimExist(5600) && Life = 0
value = 5600

[State 4008, 1]
type = SelfState
trigger1 = (Anim = 5035 && !AnimTime) || (!SelfAnimExist(5035) && Anim = 5030 && !AnimTime)
value = 5050

;---------------------------------------------------------------------------
;Metroid
[Statedef 4010]
type    = A
movetype= A
physics = S
velset = 0,0
anim = 4010
ctrl = 0
sprpriority = 2

[State 4010, 1]
type = HitDef
Trigger1 = !Time
attr = S, HT
hitflag = MAF+
priority = 1, Miss
sparkno = -1
p1sprpriority = 1
p1facing = 1
p2facing = 1
p1stateno = 4011
p2stateno = 4006
guard.dist = 0
fall = 1

[State 4010, 2]
type = ScreenBound
trigger1 = 1
value = 0 

[State 4010, 3]
type = DestroySelf
trigger1 = Time = 10

;---------------------------------------------------------------------------
;Metroid
[Statedef 4011]
type    = A
movetype= A
physics = N
velset = 0,0
ctrl = 0
sprpriority = 3

[State 4011, TargetBind]
type = TargetBind
trigger1 = NumTarget
time = 1
pos = 0,0

[State 4011, 2]
type = TargetLifeAdd
trigger1 = (GameTime %2 = 0)
value = ceil(-1*root,Fvar(20))
kill = 0

[State 4011, 3]
type = PlaySnd
trigger1 = !Time 
value = S4007,0

[State 4011, 4]
type = VelSet
trigger1 = !Time
y = 5*const(size.yscale)

[State 4011, 5]
type = VelSet
trigger1 = Pos Y >= -70*const(size.yscale)
y = 0

[State 4011, 8]
type = ChangeState
trigger1 = root,StateNo = 4004 && root,AnimElem = 9
trigger2 = root,StateNo != [4000,4999]
value = 4012+(1*(root,StateNo != [4000,4999]))
;---------------------------------------------------------------------------
;Metroid
[Statedef 4012]
type    = A
movetype= I
physics = N
velset = 0,0
anim = 4010
ctrl = 0
sprpriority = 3

[State 4012, 1]
type = VelAdd
trigger1 = 1
y = -.5*const(size.yscale)

[State 4012, 2]
type = TargetBind
trigger1 = !Time
time = 1
pos = 0,30*const(size.yscale)

[State 4012, 3]
type = TargetState
trigger1 = NumTarget && !Time
value = 4007 

[State 4012, 3]
type = TargetState
trigger1 = NumTarget && Time = 4
value = 4008 

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 4 || Time = 8 || Time = 10 || Time = 12 || Time = 14
value = F5,4

[State 0, Explod]
type = Explod
trigger1 = Time = 4 || Time = 8 || Time = 10 || Time = 12 || Time = 14
anim = 6001
ID = 4000
pos = 0,-20
postype = P2  ;P2, Front, Back, Left, Right
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 8
ontop = 1
ownpal = 1

[State 4012, 3]
type = TargetState
trigger1 = NumTarget && Time = 32
value = 4009

[State 0, TargetLifeAdd]
type = TargetLifeAdd
trigger1 = Time = 4 || Time = 8 || Time = 10 || Time = 12 || Time = 14
value = ceil(-80*root,Fvar(20))
kill = 1
absolute = 0

[State 0, HitAdd]
type = HitAdd
trigger1 = Time = 4 || Time = 8 || Time = 10 || Time = 12 || Time = 14
value = 1

[State 4003, 7]
type = ParentVarSet
trigger1 = NumTarget && WinKO && RoundState = 3
var(28) = 400

[State 3055, 5]
type = Null
triggerall = NumTarget && RoundState = 3 && (Time = 4 || Time = 8 || Time = 10 || Time = 12 || Time = 14) && parent,Var(28) != 0
trigger1 = WinKO
var(28) = 305
ignorehitpause = 1

[State 4012, 5]
type = DestroySelf
trigger1 = !NumTarget && Time >= 120

;---------------------------------------------------------------------------
;Mine
[Statedef 4020]
type    = S
movetype= A
physics = N
velset = 0,0
anim = 4020
ctrl = 0
sprpriority = 3

[State 4020, 1]
type = PlaySnd
trigger1 = !Time
value = S1160,0

[State 4020, 2]
type = ChangeState
trigger1 = Time = 130
value = 4021
;---------------------------------------------------------------------------
;Mine
[Statedef 4021]
type    = S
movetype= A
physics = N
velset = 0,0
anim = 4021
ctrl = 0
sprpriority = 3

[State 4021, 1]
type = Null
trigger1 = !Time
attr = A, HA
damage = floor(80*root,fvar(2)),20
animtype = Hard
hitflag = MAF
priority = 5, Hit
getpower = 0
givepower = 55
pausetime = 1,21
sparkno = S6001
sparkxy = -9,0
hitsound = F5, 4
guardsound = F6, 0
ground.type = High
ground.slidetime = 11
guard.hittime  = 5
ground.hittime  = 18
ground.velocity = -1.3*const(size.xscale), -3.8*const(size.yscale)
air.type = High
air.velocity = -.4*const(size.xscale), -19.1*const(size.yscale)
air.hittime = 15
yaccel = .35*const(size.yscale)
fall = 1
fall.recover = 0
fall.recovertime = 1
yaccel = .5
id = 4000
hitonce = 0
kill = 1
guard.kill = 1
fall.kill = 1
numhits = 1

[State 4021, 2]
type = ParentVarSet
trigger1 = MoveHit && WinKO
var(4) = 1
ignorehitpause = 1

[State 4021, 3]
type = PlaySnd
trigger1 = !Time 
value = S1160,1

[State 4021, 4]
type = DestroySelf
trigger1 = !AnimTime

